#include <bits/stdc++.h>

#define ll long long
#define ull unsigned long long
#define uint unsigned int

#define YES cout << "YES" << '\n'
#define NO cout << "NO" << '\n'
#define endl '\n'
const int INF = 1e9;
const int MOD = 998244353;
using namespace std;

/*思考
ans=m^n−m∗(m−1)^(n−1)
组合＋快速幂
*/
ll q_pow(ll a, ll n) {
    ll ans = 1;
    while (n) {
        if (n & 1) ans = (ll)ans * a % 100003;
        a = (a * a) % 100003;
        n >>= 1;
    }
    return ans;
}
int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    ll n, m;
    cin >> m >> n;  // m种信仰 n个房间
    ll sum = q_pow(m, n);
    ll cnt = ((m % 100003) * q_pow(m - 1, n - 1)) % 100003;
    cout << (sum - cnt + 100003) % 100003 << endl;
    return 0;
}